<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>viewOrder</title>
    <link rel="StyleSheet" href="/css/jpetstore.css" type="text/css" media="screen"/>
</head>
<body>

<div id="Content">
    <div id="BackLink">
        <a href="/admin/main">Return to Main</a>
    </div>

    <div id="Catalog">

        <table>
            <tr>
                <td th:text="'ORDER '+${now_order.orderId}" align="center" >Order #</td>
                <td th:text="${now_order.orderDate}"
                    pattern="yyyy/MM/dd hh:mm:ss" >
                    now_order.orderDate
                </td>
            </tr>
            <tr>
                <th colspan="2">Payment Details</th>
            </tr>
            <tr>
                <td>Card Type:</td>
                <td th:text="${now_order.cardType}" /></td>
            </tr>
            <tr>
                <td>Card Number:</td>
                <td th:text="${now_order.creditCard}" /></td>
            </tr>
            <tr>
                <td>Expiry Date (MM/YYYY):</td>
                <td th:text="${now_order.expiryDate}" /></td>
            </tr>
            <tr>
                <th colspan="2">Billing Address</th>
            </tr>
            <tr>
                <td>First name:</td>
                <td th:text="${now_order.billToFirstName}" /></td>
            </tr>
            <tr>
                <td>Last name:</td>
                <td th:text="${now_order.billToLastName}" /></td>
            </tr>
            <tr>
                <td>Address 1:</td>
                <td th:text="${now_order.billAddress1}" /></td>
            </tr>
            <tr>
                <td>Address 2:</td>
                <td th:text="${now_order.billAddress2}" /></td>
            </tr>
            <tr>
                <td>City:</td>
                <td th:text="${now_order.billCity}" /></td>
            </tr>
            <tr>
                <td>State:</td>
                <td th:text="${now_order.billState}" /></td>
            </tr>
            <tr>
                <td>Zip:</td>
                <td th:text="${now_order.billZip}" /></td>
            </tr>
            <tr>
                <td>Country:</td>
                <td th:text="${now_order.billCountry}" /></td>
            </tr>
            <tr>
                <th colspan="2">Shipping Address</th>
            </tr>
            <tr>
                <td>First name:</td>
                <td th:text="${now_order.shipToFirstName}" /></td>
            </tr>
            <tr>
                <td>Last name:</td>
                <td th:text="${now_order.shipToLastName}" /></td>
            </tr>
            <tr>
                <td>Address 1:</td>
                <td th:text="${now_order.shipAddress1}" /></td>
            </tr>
            <tr>
                <td>Address 2:</td>
                <td th:text="${now_order.shipAddress2}" /></td>
            </tr>
            <tr>
                <td>City:</td>
                <td th:text="${now_order.shipCity}" /></td>
            </tr>
            <tr>
                <td>State:</td>
                <td th:text="${now_order.shipState}" /></td>
            </tr>
            <tr>
                <td>Zip:</td>
                <td th:text="${now_order.shipZip}" /></td>
            </tr>
            <tr>
                <td>Country:</td>
                <td th:text="${now_order.shipCountry}" /></td>
            </tr>
            <tr>
                <td>Courier:</td>
                <td th:text="${now_order.courier}" /></td>
            </tr>
            <tr>
                <td>Status:</td>
                <td th:text="${now_order.status}" /></td>
            </tr>
            <tr>
                <td colspan="2">
                    <table>
                        <tr>
                            <th>Item ID</th>
                            <th>Description</th>
                            <th>Quantity</th>
                            <th>Price</th>
                            <th>Total Cost</th>
                        </tr>
                        <tr th:each="lineItem:${now_order.getLineItems()}">
                            <td><a th:href="@{'viewItem?itemId='+${lineItem.item.itemId}}">
                            </a></td>
                            <td th:if="${lineItem.item!=null}" th:text="${lineItem.item.attribute1}+
                                             ${lineItem.item.attribute2}+
                                             ${lineItem.item.attribute3}+
                                             ${lineItem.item.attribute4}+
                                             ${lineItem.item.attribute5}+
                                             ${lineItem.item.product.name}">
                            <td th:if="${lineItem.item==null}">
                                <i>{description unavailable}</i>
                            </td>

                    </table>
                </td>
            </tr>
            <td>
                <a class="Button" href="#">Delete</a>
                <a class="Button" href="#">Edit</a>
                <a class="Button" href="#">Send</a>
            </td>
        </table>

    </div>
</div>

</body>
</html>